Skip to content

Provide frequency/duty_cycle API for PwmOut::begin(...). #204

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 13, 2023
Merged

Conversation

aentinger
Copy link
Contributor

This fixes #168 .

A short example sketch to test this could be:

#include "pwm.h"

PwmOut pwm_freq(3);

void setup()
{
  Serial.begin(9600);
  while (!Serial) { }
  
  if (!pwm_freq.begin(10*1000*1000.0f, 50.0f))
    Serial.println("Error");
}

void loop() {

}

1 MHz ✔️

image

5 MHz ✔️

image

10 MHz ✔️

image

Although the generated frequency wanders ever more off the desired target. FYI @maidnl .

@aentinger aentinger self-assigned this Dec 12, 2023
@per1234 per1234 added type: enhancement Proposed improvement topic: code Related to content of the project itself labels Dec 12, 2023
@aentinger aentinger merged commit 7788752 into main Dec 13, 2023
@aentinger aentinger deleted the fix-168 branch December 13, 2023 05:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: code Related to content of the project itself type: enhancement Proposed improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add function that takes frequency/duty cycle as arguments for creating PWM signals
2 participants